package com.controller;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/first")
public class FirstServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("---first---");

        //下面就是动态注册的代码，但不能在servlet里面进行，会报IllegalStateException异常
   /*     ServletContext servletContext = req.getServletContext();

        ServletRegistration.Dynamic registration = servletContext.addServlet("xxxx", "com.controller.SecondServlet");
        registration.addMapping("/second");*/

    }
}
